package org.balabala.gateway.feign;

import org.balabala.gateway.entity.SysMenuEntity;
import org.balabala.gateway.entity.SysRoleEntity;
import org.balabala.gateway.entity.SysUserEntity;
import org.balabala.gateway.response.Resp;
import org.balabala.gateway.utils.PasswordForm;
import org.balabala.gateway.utils.SysLoginForm;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Component
@FeignClient(name = "admin")
public interface AdminFeign {
    @GetMapping("/renren-fast/captcha.jpg")
    Resp getCaptcha(@RequestParam String uuid, @RequestParam String code);

    @PostMapping("/renren-fast/sys/token")
    Resp getByToken(@RequestBody String token);

    @PostMapping("renren-fast/sys/login")
    Map<String, Object> login(@RequestBody SysLoginForm form);

    @PostMapping("/renren-fast/sys/logout")
    Resp logout(@RequestParam Long userId);

    @PostMapping("/renren-fast/sys/user/save")
    Resp saveUser(@RequestBody SysUserEntity user);

    @PostMapping("/renren-fast/sys/user/password")
    Resp password(@RequestBody PasswordForm form);

    @GetMapping("/renren-fast/sys/user/list")
    Resp list(@RequestParam Map<String, Object> params);


    @PostMapping("/renren-fast/sys/user/delete")
    Resp deleteUser(@RequestBody Long[] userIds);

    @GetMapping("/renren-fast/sys/user/info/userid")
    Resp infobyUid(@RequestParam Long userId);

    @PostMapping("/renren-fast/sys/user/update")
    Resp update(@RequestBody SysUserEntity user);

    @GetMapping("/renren-fast/sys/role/list")
    Resp roleList(@RequestParam Map<String, Object> params);

    @GetMapping("renren-fast/sys/role/select")
    Resp select(@RequestParam Long userId);

    @GetMapping("/renren-fast/sys/role/info/roleid")
    Resp info(@RequestParam Long roleId);

    @PostMapping("/renren-fast/sys/role/save")
    Resp save(@RequestBody SysRoleEntity role);

    @PostMapping("/renren-fast/sys/role/update")
    Resp roleUpdate(@RequestBody SysRoleEntity role);

    @PostMapping("/renren-fast/sys/role/delete")
    Resp deleteRole(@RequestBody Long[] roleIds);

    @GetMapping("/renren-fast/sys/menu/nav")
    Resp nav(@RequestParam Long userId);

    @GetMapping("/renren-fast/sys/menu/list")
    List<SysMenuEntity> navList();

    @GetMapping("/renren-fast/sys/menu/select")
    Resp menuSelect();

    @GetMapping("/renren-fast/sys/menu/info/menuid")
    Resp menuInfo(@RequestParam Long menuId);

    @PostMapping("/renren-fast/sys/menu/save")
    Resp saveMenu(@RequestBody SysMenuEntity menu);

    @PostMapping("/renren-fast/sys/menu/update")
    Resp updateMenu(@RequestBody SysMenuEntity menu);

    @PostMapping("/renren-fast/sys/menu/delete")
    Resp deleteMenu(@RequestParam long menuId);

}
